﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;

namespace NaviCar.Helpers
{
    public class Contexto
    {
        public static int RecuperarValorCodigoPessoaCookie()
        {
            int codigoPessoa = 0;

            HttpCookie cookie = HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName];

            if (cookie != null)
            {
                FormsAuthenticationTicket auth = FormsAuthentication.Decrypt(cookie.Value);

                codigoPessoa = int.Parse(auth.UserData);
            }

            return codigoPessoa;
        }
    }
}